package com.funtl.apache.dubbo.log.service.impl;

import com.funtl.apache.dubbo.log.dao.OrderLogDao;
import com.funtl.apache.dubbo.log.dto.OrderLogDto;
import com.funtl.apache.dubbo.log.service.OrderLogService;
import com.funtl.apache.dubbo.provider.log.api.domain.TbOrderLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class OrderLogServiceImpl implements OrderLogService {

    @Autowired
    private OrderLogDao orderLogDao;

    @Override
    public void insert(OrderLogDto orderLogDto) {
        Long currentUnix = new Date().getTime();
        TbOrderLog tbOrderLog = new TbOrderLog();
        tbOrderLog.setOrderId(orderLogDto.getOrderId());
        tbOrderLog.setOrderItemId(orderLogDto.getOrderItemId());
        tbOrderLog.setGmtCreate(currentUnix);
        tbOrderLog.setGmtModified(currentUnix);

        orderLogDao.insert(tbOrderLog);
    }
}
